/**
 * 
 */

$(function(){
	$('#department').treegrid({  
	    url:'data/department.json',  
	    idField:'id',  
	    treeField:'name',  
	    striped:true,
		border: true,
		collapsible:false,//是否可折叠的  
		fitColumns: true,
		loadMsg:"数据正在加载,请稍候...",
		rownumbers:true,
		singleSelect:false,
		selectOnCheck: true,
		checkOnSelect: true,
	    columns:[[  
	              {field:'ck',checkbox:true},
	        {title:'部门名称',field:'name',width:$(this).width() * 0.5},  
	        {field:'unable',title:'是否失效',width:$(this).width()* 0.2,},  
	        {field:'note',title:'备注',width:$(this).width() * 0.3} 
	    ]],
	    toolbar: [{  
            text: '添加',  
            iconCls: 'icon-add',  
            handler: function() {  
            	showAdd("#dlg","新增部门","#departmentForm","index.json");
            }  
        }, '-', {  
            text: '修改',  
            iconCls: 'icon-edit',  
            handler: function() {  
            	showEdit('#department','#dlg','修改部门','#fm','data/index.json');
            }  
        }, '-',{  
            text: '删除',  
            iconCls: 'icon-remove',  
            handler: function(){  
                del('#department','data/index.json');  
            }  
        }/*, '-',{  
            text: '转移',  
            iconCls: 'icon-nav-punishment',  
            handler: function(){  
                view('#department','#viewplan','查看计划');  
            }  
        }*/]
	});  
	
});